/*
 * @Author: LVGRAPE
 * @LastEditors: LVGRAPE
 */

#ifndef _DRV_PWM_H
#define _DRV_PWM_H

#include "drv_pin.h"

#define LED1_PIN PA6
#define LED2_PIN PA7
#define LED3_PIN PB0
#define LED4_PIN PB1

#define HW_MOTOR_CONT 4

#ifdef __cplusplus
extern "C"
{
#endif

    void pwm_init(void);
    int at32_tmr_pwm_dma_init(void);
    void motor_set_duty(uint8_t channel, uint16_t duty);
    void motors_set(uint16_t duty1, uint16_t duty2, uint16_t duty3, uint16_t duty4);
    void motor_set_freq(uint32_t freq);
    void motor_off(void);
    void motor_on(void);

    extern int16_t motor_values[4];
#ifdef __cplusplus
}
#endif

#endif /* _DRV_PWM_H */
